Add StaticSiteConstruct for comprehensive static website hosting#9
Merged
Conversation
• Add StaticSiteConstruct with S3, CloudFront, SSL, Route53, and asset deployment • Support optional API proxying through CloudFront behaviors for /api/* paths • Include alternate domain configuration for multi-domain sites • Add comprehensive testing infrastructure with AutoFixture and CDK assertions • Include fluent builders for common scenarios (blog, docs, SPA) • Add XML documentation for all public APIs • Update README.md and CLAUDE.md with complete documentation and examples 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
• Replace unused app variables with _ discard pattern • Replace unused construct variables with _ discard pattern • Apply linter formatting fix for array initialization syntax • Maintain construct instantiation for test side effects 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
• Fix README documentation: script.js → app.js, add about.html • Add comprehensive unit tests for StaticSiteConstructCustomization • Verify parameterized behavior for includeApiDomain and includeAlternateDomains • Test CdkTestHelper.CreateStaticSitePropsBuilder() with defaults and custom paths • Ensure testing infrastructure works correctly with AutoFixture 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
• Add PropsBuilder_ShouldConfigureSnapStart test for EnableSnapStart = true • Add PropsBuilder_ShouldDisableSnapStart test for EnableSnapStart = false • Verify WithSnapStart method works correctly in both enabled and disabled states • Complete test coverage for LambdaFunctionConstructPropsBuilder 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
• Change default _assetPath from "./test-static-site" to CdkTestHelper.GetTestAssetPath("TestAssets/static-site")
• Ensure default path matches actual test asset directory structure
• Prevent test failures when using builder directly without explicit asset path
• Maintain consistency with actual test asset organization
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new StaticSiteConstruct to provide end-to-end static website hosting on S3, CloudFront, SSL certificates, Route53, and optional API proxying. It also introduces comprehensive testing support (builders, assertions, custom AutoFixture customizations), sample static-site test assets, and updates documentation.
- Introduce
StaticSiteConstructimplementation with S3 bucket, CloudFront, certificate, DNS, and deployments - Add test support:
StaticSiteConstructPropsBuilder,StaticSiteConstructAssertions, AutoFixture customizations/attributes, and sample test assets - Update README and CLAUDE guidance with usage examples and test instructions
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/LayeredCraft.Cdk.Constructs.Tests/Testing/TestingHelpersTests.cs | Add tests for StaticSiteConstructCustomization and builder defaults |
| test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Customizations/StaticSiteConstructCustomization.cs | New AutoFixture customization for StaticSiteConstructProps |
| test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Attributes/StaticSiteConstructAutoDataAttribute.cs | New [StaticSiteConstructAutoData] attribute |
| test/LayeredCraft.Cdk.Constructs.Tests/TestAssets/static-site/* | Add sample static-site assets (HTML, CSS, JS) |
| test/LayeredCraft.Cdk.Constructs.Tests/LayeredCraft.Cdk.Constructs.Tests.csproj | Include static-site assets in test project output |
| test/LayeredCraft.Cdk.Constructs.Tests/Constructs/StaticSiteConstructTests.cs | Add unit tests covering StaticSiteConstruct scenarios |
| src/LayeredCraft.Cdk.Constructs/Testing/StaticSiteConstructPropsBuilder.cs | Add fluent builder for static-site props |
| src/LayeredCraft.Cdk.Constructs/Testing/StaticSiteConstructAssertions.cs | Add CDK assertion helpers for static-site constructs |
| src/LayeredCraft.Cdk.Constructs/Testing/CdkTestHelper.cs | Extend CdkTestHelper with CreateStaticSitePropsBuilder |
| src/LayeredCraft.Cdk.Constructs/Models/StaticSiteConstructProps.cs | Add IStaticSiteConstructProps and StaticSiteConstructProps record |
| src/LayeredCraft.Cdk.Constructs/Constructs/StaticSiteConstruct.cs | Implement the new StaticSiteConstruct class |
| README.md | Document static-site construct usage and testing |
| CLAUDE.md | Update guidance for static-site construct features |
Comments suppressed due to low confidence (2)
test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Customizations/StaticSiteConstructCustomization.cs:9
- [nitpick] Add
<param>XML documentation forincludeApiDomainandincludeAlternateDomainsparameters to clarify their purpose.
public class StaticSiteConstructCustomization(bool includeApiDomain = true, bool includeAlternateDomains = true)
test/LayeredCraft.Cdk.Constructs.Tests/Testing/TestingHelpersTests.cs:1
- The test uses
Path.IsPathRooted(...)butSystem.IOis not imported. Addusing System.IO;at the top of the file.
using Amazon.CDK.Assertions;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
• Add StaticSiteConstruct with S3, CloudFront, SSL, Route53, and asset deployment
• Support optional API proxying through CloudFront behaviors for /api/* paths
• Include alternate domain configuration for multi-domain sites
• Add comprehensive testing infrastructure with AutoFixture and CDK assertions
• Include fluent builders for common scenarios (blog, docs, SPA)
• Add XML documentation for all public APIs
• Update README.md and CLAUDE.md with complete documentation and examples
Test Plan
🤖 Generated with Claude Code